#include "CWidthSearch.h"

CWidthSearch::CWidthSearch()
{
}

int CWidthSearch::select(void)
{
	float min=0;
	int id=-1;
	for (std::list<int>::iterator it=open.begin();it!=open.end();++it)
	{
		if (*it == target)
		{
			return *it;
		}
		if ((cost[*it]<=min && cost[*it]!=-1.0f) || (id==-1 && cost[*it]!=-1.0f))
		{
			id=*it;
			min=cost[*it];
		}
	}
	return id;
}